//
//  MainEveryBallView.swift
//  MakeMoney
//
//  Created by Fan ZhiQiang on 2025/3/26.
//

import SwiftUI



struct MainEveryBallView: View {
    @Bindable var pathStore: PathStore
    let columns = [GridItem(.adaptive(minimum: 80, maximum: 90), spacing: 20)]
    @State private var isHidden = true
    var body: some View {
        VStack {
            ScrollView {
                LazyVGrid(columns: columns, alignment: .leading, spacing: 20) {
                    ForEach(1..<38) { num in
                        Button {
                            pathStore.path.append(MainProbablyPath(param: num))
                        } label: {
                            Text("\(num)")
                                .font(.title)
                                .foregroundStyle(.white)
                                .frame(minWidth: ballWidth, idealWidth: ballWidth, maxWidth: ballWidth, minHeight: ballWidth, idealHeight: ballWidth, maxHeight: ballWidth, alignment: .center)
                                .background(.blue)
                                .clipShape(.circle)
                        }
                    }
                }
                .padding(.horizontal, 20)
            }
        }
        .navigationDestination(for: MainProbablyPath.self) { path in
            MainProbablyView(pathStore: pathStore, chooseNum: path.param)
        }
        .toolbar(.hidden, for: .tabBar)
        .navigationTitle("概率")
        .navigationBarTitleDisplayMode(.inline)
    }
}

#Preview {
    MainEveryBallView(pathStore: .init())
}

class MainEveryBallPath: PathName {}
